/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mypackage;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;

/**
 * @author zinin
 */
public class Midlet extends MIDlet implements CommandListener{
    private MyGameCanvas midpCanvas;
    private Display display;
    public static final Command exitCommand = new Command( "Exit", Command.EXIT, 1 ); 

    public void startApp() {
        display = Display.getDisplay( this );
        midpCanvas = new MyGameCanvas();                                    
        midpCanvas.setTitle("midpCanvas");
        midpCanvas.addCommand(exitCommand);
        midpCanvas.setCommandListener(this);
        display.setCurrent(midpCanvas);
    }
    
    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
        exitMIDlet();
    }

    public void commandAction(Command c, Displayable d) {
        if( c == exitCommand ){
            exitMIDlet();
        }
    }

    public void exitMIDlet(){
        notifyDestroyed();
    }
    
}
